<template>
  <d2-container>
    <div style="width:100%;display:flex;">
      <el-card shadow="always" style="width:35%;margin-right:1%;margin-left:1%;">
        <h3 style="margin-left:15px;">快速入口</h3>
        <div style="display:flex;justify-content: space-around">
          <div @click="$router.push('/Launch_event')" style="width:150px;height:80px;background:linear-gradient(to right, rgba(61, 187, 88, 1) 0%, rgba(69, 206, 98, 1) 100%);
border-radius:10px;display:flex;justify-content:center;align-items: center;cursor: pointer;
">
            <i class="el-icon-s-promotion" style="color:white;margin-right:5px;font-size:18px;"></i>
            <span style="font-size:18px;color:white;">发布任务</span>
          </div>
          <div @click="$router.push('/evaluatelist')" style="width:150px;height:80px;background: linear-gradient(to right, rgba(243, 84, 72, 1) 0%, rgba(253, 98, 86, 1) 100%);
border-radius:10px;display:flex;justify-content:center;align-items: center;cursor: pointer;
">
            <i class="el-icon-s-order" style="color:white;margin-right:5px;font-size:18px;"></i>
            <span style="font-size:18px;color:white;">审核订单</span>
          </div>
        </div>
        <br/>
        <div style="display:flex;justify-content: space-around">
          <div @click="$router.push('/orderlist')" style="width:150px;height:80px;background: linear-gradient(to right, rgba(251, 198, 71, 1) 0%, rgba(255, 211, 105, 1) 100%);
border-radius:10px;display:flex;justify-content:center;align-items: center;cursor: pointer;
">
            <i class="el-icon-star-on" style="color:white;margin-right:5px;font-size:18px;"></i>
            <span style="font-size:18px;color:white;">订单审核</span>
          </div>
          <div @click="$router.push('/Admin_adv')" style="width:150px;height:80px;background:rgb(63,65,77);
border-radius:10px;display:flex;justify-content:center;align-items: center;cursor: pointer;
">
            <i class="el-icon-s-operation" style="color:white;margin-right:5px;font-size:18px;"></i>
            <span style="font-size:18px;color:white;">平台公告</span>
          </div>
        </div>
      </el-card>
      <el-card shadow="always" style="width:65%;margin-right:1%;">
        <div style="display:flex;">
          <img src="../../../assets/u=1990625098,3468619056&fm=11&gp=0.jpg" style="width:80px;border-radius:50%;"
               alt="">
          <div style="display:flex;flex-direction: column;justify-content: space-around;margin-left:1%;">
            <div style="display:flex;">
              <el-tag type="info" style="background:#bababa;color:white;">Hi！番茄通欢迎你,{{ userInfo.user }}</el-tag>
              <el-tag
                style="color:white;background: linear-gradient(to right, rgba(130, 122, 243, 1) 0%, rgba(180, 122, 243, 1) 100%)">
                ID：{{ userInfo.id }}
              </el-tag>
            </div>
            <el-tag type="warning">注册时间：{{ userInfo.create_time * 1000 | moment }}</el-tag>
          </div>
        </div>
        <br/>
        <div style="display:flex;justify-content: space-around">
          <el-card style="display:flex;justify-content: space-around;align-items: center">
            <el-tag effect="plain" style="cursor:pointer;">
              充值总额：{{ money.money_count }}
            </el-tag>
            <el-tag effect="plain" type="success" style="margin-left:10px;cursor:pointer;">
              可用余额：{{ money.remaining_money }}
            </el-tag>
            <el-tag effect="plain" type="danger" style="margin-left:10px;cursor:pointer;">
              放单总额：{{ money.consumption_money }}
            </el-tag>
          </el-card>
          <el-card style="width:45%;">
            <div style="display:flex;justify-content:space-around;align-items: center;">
              <div
                style="display:flex;flex-direction: column;justify-content:space-around;align-items: center;height:100px;">
                <el-tag type="info" effect="dark" style="">客服微信</el-tag>
                <el-tag type="info" effect="dark" style="">24小时客服,为您服务</el-tag>
              </div>
              <img style="width:100px;height:100px;margin-left:2%"
                   src="../../../assets/91bfae8fa3070c18be8914c5a0dd8fa.jpg" alt="">
            </div>
          </el-card>
        </div>
      </el-card>
    </div>
    <div style="width:98%;display:flex;justify-content: space-between;margin:1% auto">
      <el-card
        style="width:25%;display:flex;flex-direction: column;height:100px;align-items: center;justify-content: center;text-align: center">
        <p>当天任务总数</p>
        <p style="font-size:20px;font-weight:600;">{{ task.task_count }}</p>
      </el-card>
      <el-card
        style="width:24%;display:flex;flex-direction: column;height:100px;align-items: center;justify-content: center;text-align: center">
        <p>当天已完成任务数</p>
        <p style="font-size:20px;font-weight:600;">{{ task.overtk_count }}</p>
      </el-card>
      <el-card
        style="width:24%;display:flex;flex-direction: column;height:100px;align-items: center;justify-content: center;text-align: center">
        <p>当天进行中任务数</p>
        <p style="font-size:20px;font-weight:600;">{{ task.conducttk_count }}</p>
      </el-card>
      <el-card
        style="width:24%;display:flex;flex-direction: column;height:100px;align-items: center;justify-content: center;text-align: center">
        <p>当天剩余任务数</p>
        <p style="font-size:20px;font-weight:600;">{{ task.remaining_cont }}</p>
      </el-card>
    </div>
    <el-dialog
      title="未处理评价订单"
      :visible.sync="dialogVisible"
      width="30%">

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <div style="display:flex;width:98%;margin: 0 auto">
      <el-card style="width:70%">
        <h3 style="margin-left:1%">最新资金记录</h3>
        <div>
          <el-button type="primary" @click="fundingdetailss(1)">支付宝</el-button>
          <el-button type="primary" @click="fundingdetailss(2)">银行卡</el-button>
          <el-button type="primary" @click="fundingdetailss(3)">消费</el-button>
        </div>
        <el-table
          :data="tableData"
          border
          style="width: 98%;margin: 0 auto;height:200px;overflow-y: scroll;">
          <el-table-column
            prop="Description"
            label="资金ID"
            width="400">
          </el-table-column>
          <el-table-column
            prop="create_time"
            label="发生日期"
            width="200">
          </el-table-column>
          <el-table-column
            prop="money_change"
            label="发生金额">
          </el-table-column>
          <el-table-column
            prop="status"
            label="款项类型"
            width="">
          </el-table-column>
          <el-table-column
            prop="types"
            label="状态">
          </el-table-column>
        </el-table>
      </el-card>
      <el-card style="width:30%;margin-left:2%">
        <h3 style="margin-left:1%">我的店铺</h3>
        <el-table
          :data="tableDataing"
          style="width: 98%;margin: 0 auto">
          <el-table-column type="index" align="center" prop="company_id" label="序号">
          </el-table-column>
          <el-table-column
            prop="shopname"
            label="店铺旺旺"
            width="">
          </el-table-column>
          <el-table-column label="绑定时间" prop="create_time" align="center" width="">
          </el-table-column>
        </el-table>
      </el-card>
      <el-dialog
        title="未评价内容"
        :visible.sync="dialogVisibling"
        width="80%">
        <el-table
          border
          :data="tableDataes"
          style="width: 100%">
          <el-table-column
            prop="id"
            align="center"
            label="序号">
          </el-table-column>
          <el-table-column
            prop="shop_name"
            label="店铺名字"
            align="center">
          </el-table-column>
          <el-table-column
            prop="task_order"
            align="center"
            label="单号">
          </el-table-column>
          <el-table-column
            prop="tb_account"
            align="center"
            label="旺旺">
          </el-table-column>
          <el-table-column
            prop="status"
            align="center"
            label="评价状态">
            <template slot-scope="scope">
                  {{['','待上传评价','评价完成','评价待审核'][scope.row.status]}}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            label="时间">
            <template slot-scope="scope">
              <span>{{scope.row.create_time}}</span>
            </template>
          </el-table-column>
        </el-table>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="dialogVisibling = false">确 定</el-button>
        </span>
      </el-dialog>
    </div>
  </d2-container>
</template>

<script>
import {userinfo, statistics_money, statistics_task, fundingdetails, shoplist} from "@/api/api";
export default {
  name: "index",
  inject: ['reload'],
  data() {
    return {
      tableDataes:[],
      dialogVisibling:false,
      dialogVisible:false,
      tableDataing: [],
      options: [{
        value: '1',
        label: '支付宝'
      }, {
        value: '2',
        label: '银行卡'
      }, {
        value: '3',
        label: '消费 '
      }],
      userInfo: {},
      tableData: [],
      money: {},
      task: {},
      types: '',
      currentPage1: 1
    }
  },
  methods: {

    //shop列表
    getShopList() {
      shoplist().then(res => {
        if (res.Status == 200) {
          for (let item of res.Data) {
            var timestamp4 = new Date(item.create_time * 1000)
            let timer = new Date(item.update_time * 1000)
            item.create_time = timestamp4.toLocaleDateString().replace(/\//g, "-") + " " + timestamp4.toTimeString().substr(0, 8)
            item.update_time = timer.toLocaleDateString().replace(/\//g, "-") + " " + timer.toTimeString().substr(0, 8)
          }
          this.tableDataing = res.Data
        }
      })
    },
    fundingdetailss(val) {
      if (this.types == '') {
        this.types = 1
      } else {
        this.types = val
      }
      let params = {
        types: this.types
      }
      fundingdetails(params).then(res => {
        this.tableData = res.Data
        this.getShopList()
      })
    },
    statistics_moneys() {
      statistics_money().then(res => {
        this.money = res.Data
        this.statistics_tasks()
      })
    },
    statistics_tasks() {
      statistics_task().then(res => {
        this.task = res.Data
        this.fundingdetailss()
      })
    },
    userinfos() {
      // if (window.location.href.indexOf("#xfq") == -1) {
      //   window.location.href = window.location.href + "#xfq";
      //   window.location.reload();
      // }
      userinfo().then(res => {
        this.userInfo = res.Data
        // this.tableDataes =res.Data.evaluate
        // if(this.tableDataes.length>0){
        //    this.dialogVisibling = true
        // }
        // console.log(this.tableDataes);
      })
      // this.userInfo = JSON.parse(window.localStorage.getItem('userinfoing'))
      // console.log(this.userInfo,'123');
    }
  },
  created() {
    this.userinfos()
    this.statistics_moneys()
  },
}
</script>

<style>

</style>
